From 63f0b0246b8125ae48b15bd182bb5831be02e6c9 Mon Sep 17 00:00:00 2001
From: Angelo Compagnucci <angelo.compagnucci@gmail.com>
Date: Mon, 27 Jun 2016 21:32:11 +0200
Subject: [PATCH] fix musl incorrect sigcontext include

On musl __GLIBC__ is not defined, so the conditional logic will
not produce correct result. Add a specific case to handle when
__GLIBC__ is not defined.

Signed-off-by: Angelo Compagnucci <angelo.compagnucci@gmail.com>
---
 libgc/os_dep.c             | 2 +-
 mono/mini/exceptions-arm.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/libgc/os_dep.c b/libgc/os_dep.c
index 8c8e098..34859c1 100644
--- a/libgc/os_dep.c
+++ b/libgc/os_dep.c
@@ -32,7 +32,7 @@
       /* prototypes, so we have to include the top-level sigcontext.h to    */
       /* make sure the former gets defined to be the latter if appropriate. */
 #     include <features.h>
-#     if 2 <= __GLIBC__
+#     if 2 <= __GLIBC__ || !defined(__GLIBC__)
 #       if 2 == __GLIBC__ && 0 == __GLIBC_MINOR__
 	  /* glibc 2.1 no longer has sigcontext.h.  But signal.h	*/
 	  /* has the right declaration for glibc 2.1.			*/
diff --git a/mono/mini/exceptions-arm.c b/mono/mini/exceptions-arm.c
index b036aa7..a3e2164 100644
--- a/mono/mini/exceptions-arm.c
+++ b/mono/mini/exceptions-arm.c
@@ -14,7 +14,7 @@
 #include <string.h>
 
 #ifndef MONO_CROSS_COMPILE
-#ifdef HAVE_ASM_SIGCONTEXT_H
+#if defined(HAVE_ASM_SIGCONTEXT_H) && defined(__GLIBC__)
 #include <asm/sigcontext.h>
 #endif  /* def HAVE_ASM_SIGCONTEXT_H */
 #endif
-- 
1.9.1

